package com.biostime.dingdingbox.common.utils;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import org.activiti.engine.impl.util.json.JSONException;
import org.activiti.engine.impl.util.json.JSONObject;

public class JsonToMapUtil {
	/**
     * 将Json对象转换成Map
     * @param jsonObject
     * @return Map对象
     * @throws JSONException
     */
    public static Map<String,String> toMap(String jsonString) throws JSONException {

        JSONObject jsonObject = new JSONObject(jsonString);
        
        Map<String,String> result = new HashMap<String,String>();
        Iterator<?> iterator = jsonObject.keys();
        String key = null;
        String value = null;
        
        while (iterator.hasNext()) {

            key = (String) iterator.next();
            value = jsonObject.getString(key);
            result.put(key, value);
            
            System.out.println("key:"+key);
            System.out.println("value:"+value);

        }
        return result;
    }		
}
